package com.infore.remoteControl.entity.protocolEntity;

import java.io.Serializable;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;


/**
 * 协议数据类
 * @author Cold
 *
 */
@Entity
@Table(name="PROTOCOL_DATA")
@NamedQuery(name="ProtocolData.findAll", query="SELECT p FROM ProtocolData p")
public class ProtocolData implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID")
	@GeneratedValue(generator = "uuidGenerator")
	@GenericGenerator(name = "uuidGenerator", strategy = "uuid") // UUID生成策略
	private String id;
	
	/** 协议ID(与协议关联) @JsonIgnore (防止查询时进入死循环)**/
	@JsonIgnoreProperties(value = {"protocolData"})
	@ManyToOne(fetch = FetchType.EAGER) 
	@JoinColumn(name = "PROTOCOL_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	private Protocol protocol;
	
	/** 发布日期，时间戳 **/
//	@Temporal(TemporalType.DATE)
//	@JsonFormat(pattern = "yyyy", timezone = "GMT+8")
	@Column(name="PUBLISHED_DATE")
	private String publishedDate;
	
	/** 对应版本的协议内容存放路径 **/
	@Column(name="URL", length = 30)
	private String url;
	
	public ProtocolData() {
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Protocol getProtocol() {
		return protocol;
	}

	public void setProtocol(Protocol protocol) {
		this.protocol = protocol;
	}

	public String getPublishedDate() {
		return this.publishedDate;
	}

	public void setPublishedDate(String publishedDate) {
		this.publishedDate = publishedDate;
	}

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

}